#include <iostream>
using namespace std;


int main()
{
    //获取电话号码，并将其放到数组phoneNumber
    string phone;
    cin>>phone;
    int phoneNumber[11];
    int phoneNumberLen = 11;
    for(int i =0; i<phone.length(); i++)
        phoneNumber[i] = phone[i]-'0';

    //建立电话号码中所出现的所有数字数组（无重复）digitNumber
    int digitNumber[10];
    int digitNumberLen = 0;
    for(int i = 0; i<11; i++)
    {
        int temp  = phoneNumber[i];
        bool bIfIn = false;
        for(int j = 0; j<digitNumberLen; j++)
        {
            if(digitNumber[j] == temp)
            {
                bIfIn = true;
                break;
            }
                
        }
        if(!bIfIn)
        {
            digitNumber[digitNumberLen] = temp;
            digitNumberLen++;
        }
     }

     //对digitNumber进行排序
    while(true)
    {
        bool bIfSwap = false;
        for(int i = 0; i<digitNumberLen-1; i++)
        {
            if(digitNumber[i]< digitNumber[i+1])
            {
                int temp = digitNumber[i];
                digitNumber[i] = digitNumber[i+1];
                digitNumber[i+1] = temp;
                bIfSwap = true;
            }
        }
        if(! bIfSwap) break;
    }

     
    
    //建立索引数组phoneIndex
     int phoneIndex[11];
     int phoneIndexLen = 0;
     for(int i = 0; i<phoneNumberLen; i++)
     {
         int temp = phoneNumber[i];
         for(int j =0; j<digitNumberLen; j++)
         {
             if(digitNumber[j] == temp)
             {
                 phoneIndex[phoneIndexLen] = j;
                 phoneIndexLen++;
                 break;
             }  
         }
         
     }
     cout<<"int[] arr = new int[]{";
     for(int i = 0; i<digitNumberLen-1; i++)
         cout<<digitNumber[i]<<",";
     cout<<digitNumber[digitNumberLen-1]<<"};\n";

    cout<<"int[] index = new int[]{";
    for(int i = 0; i<phoneIndexLen-1; i++)
         cout<<phoneIndex[i]<<",";
    cout<<phoneIndex[phoneIndexLen-1]<<"};";

}